/*******************************************************************************
 * Size: 14 px
 * Bpp: 1
 * Opts: --font AlibabaPuHuiTi-2-85-Bold.ttf --size 14 --bpp 1 --format lvgl -o myfont8x.c -r 0x30-0x39 --no-compress --no-prefilter
 ******************************************************************************/

//#ifdef LV_LVGL_H_INCLUDE_SIMPLE
//#include "lvgl.h"
//#else
//#include "lvgl/lvgl.h"
//#endif
#include "lv_font.h"
#include "lv_font_fmt_txt.h"

#ifndef MYFONT8X
#define MYFONT8X 1
#endif

#if MYFONT8X

/*-----------------
 *    BITMAPS
 *----------------*/

/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
    /* U+0030 "0" */
    0x38, 0xdb, 0x1e, 0x3c, 0x78, 0xf1, 0xe3, 0x6c,
    0xf0,

    /* U+0031 "1" */
    0x7f, 0xc6, 0x31, 0x8c, 0x63, 0x18, 0xc0,

    /* U+0032 "2" */
    0x78, 0x18, 0x30, 0x61, 0xc3, 0xe, 0x38, 0xe1,
    0xfc,

    /* U+0033 "3" */
    0x7c, 0xc, 0x18, 0x73, 0x81, 0xc1, 0x83, 0xf,
    0xf0,

    /* U+0034 "4" */
    0xe, 0xe, 0x1e, 0x36, 0x66, 0x66, 0xff, 0x6,
    0x6, 0x6,

    /* U+0035 "5" */
    0x7b, 0xc, 0x30, 0xf8, 0x30, 0xc3, 0x1f, 0xe0,

    /* U+0036 "6" */
    0x1c, 0xe1, 0x86, 0xf, 0xd8, 0xf1, 0xe3, 0xc6,
    0xf8,

    /* U+0037 "7" */
    0xfe, 0xc, 0x30, 0x61, 0xc3, 0x6, 0x18, 0x30,
    0xc0,

    /* U+0038 "8" */
    0x7d, 0x8f, 0x1e, 0x33, 0x98, 0xf1, 0xe3, 0xc6,
    0xf8,

    /* U+0039 "9" */
    0x7d, 0x8b, 0x1e, 0x3c, 0x6f, 0xc1, 0x86, 0x1c,
    0x60
};


/*---------------------
 *  GLYPH DESCRIPTION
 *--------------------*/

static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
    {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
    {.bitmap_index = 0, .adv_w = 131, .box_w = 7, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
    {.bitmap_index = 9, .adv_w = 131, .box_w = 5, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
    {.bitmap_index = 16, .adv_w = 131, .box_w = 7, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
    {.bitmap_index = 25, .adv_w = 131, .box_w = 7, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 34, .adv_w = 131, .box_w = 8, .box_h = 10, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 44, .adv_w = 131, .box_w = 6, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
    {.bitmap_index = 52, .adv_w = 131, .box_w = 7, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
    {.bitmap_index = 61, .adv_w = 131, .box_w = 7, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
    {.bitmap_index = 70, .adv_w = 131, .box_w = 7, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
    {.bitmap_index = 79, .adv_w = 131, .box_w = 7, .box_h = 10, .ofs_x = 1, .ofs_y = 0}
};

/*---------------------
 *  CHARACTER MAPPING
 *--------------------*/



/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
    {
        .range_start = 48, .range_length = 10, .glyph_id_start = 1,
        .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
    }
};



/*--------------------
 *  ALL CUSTOM DATA
 *--------------------*/

#if LV_VERSION_CHECK(8, 0, 0)
/*Store all the custom data of the font*/
static  lv_font_fmt_txt_glyph_cache_t cache;
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
    .glyph_bitmap = glyph_bitmap,
    .glyph_dsc = glyph_dsc,
    .cmaps = cmaps,
    .kern_dsc = NULL,
    .kern_scale = 0,
    .cmap_num = 1,
    .bpp = 1,
    .kern_classes = 0,
    .bitmap_format = 0,
#if LV_VERSION_CHECK(8, 0, 0)
    .cache = &cache
#endif
};


/*-----------------
 *  PUBLIC FONT
 *----------------*/

/*Initialize a public general font descriptor*/
#if LV_VERSION_CHECK(8, 0, 0)
const lv_font_t myfont8x = {
#else
lv_font_t myfont8x = {
#endif
    .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt,    /*Function pointer to get glyph's data*/
    .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt,    /*Function pointer to get glyph's bitmap*/
    .line_height = 10,          /*The maximum line height required by the font*/
    .base_line = 0,             /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
    .subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
    .underline_position = -1,
    .underline_thickness = 1,
#endif
    .dsc = &font_dsc           /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};



#endif /*#if MYFONT8X*/

